import json


# 封装request
def request_api(session, url, **kwargs):
    r = session.post(url, kwargs)
    if r.status_code == 200:
        result = json.loads(r.text)
        if result['errcode'] == 0:
            return result['result']
        else:
            print('errmsg:', result['errmsg'])
            return False

    else:
        print('status_code:' + str(r.status_code) + ', check you url')
        print('you url is:', r.url)
        exit()
        return False
